package com.cg.controller;

import com.cg.client.AppClient;
import com.cg.dto.Result;
import com.cg.entity.Department;
import com.cg.vo.DepartmentInfoVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName DepartmentController
 * @Description TODO
 * @Author CG
 * @Date 2024/1/7 12:33
 **/
@RestController
@RequestMapping("/department")
public class DepartmentController {

    @Resource
    private AppClient appClient;

    /**
     * 根据院区id查询科室
     */
    @GetMapping("/queryDepartmentByBranchId")
    public Result<List<Department>> queryDepartmentByBranchId(Integer branchId){
        return appClient.queryDepartmentByBranchId(branchId);
    }

    /**
     * 根据科室名称模糊查询科室列表
     */
    @GetMapping("/queryDepartmentByDepartmentName")
    public Result<List<Department>> queryDepartmentByDepartmentName(String departmentName){
        return appClient.queryDepartmentByDepartmentName(departmentName);
    }


    /**
     * 根据科室id查询科室详情
     */
    @GetMapping("/queryDepartmentInfo")
    public Result<DepartmentInfoVo> queryDepartmentInfo(Integer departmentId){
        return appClient.queryDepartmentInfo(departmentId);
    }
}
